import storage from "localforage"
import tools from "@/tools/index"

// Firefox存储库
// setDriver:自动降级存储,例如:如果浏览器不支持LOCALSTORAGE会存到INDEXEDDB
// name:数据库名称
// version:版本号,可用作强制更新用户本地数据历史版本

//修复ios在隐私模式情况下无法将数据写进LOCALSTORAGE
//支持LOCALSTORAGE的情况下,LOCALSTORAGE为最高级存储
let driver = [storage.INDEXEDDB, storage.WEBSQL];
if (tools.isSupportLocalStorage()) {
  driver = [storage.LOCALSTORAGE, ...driver]
}
storage.setDriver(driver);
storage.config({
  name: "pc",
  version: "1.0"
})
export default storage